package cn.intotw.rdcj.user.controller;


import cn.intotw.rdcj.core.bean.DataResponse;
import cn.intotw.rdcj.core.constant.Constants;
import cn.intotw.rdcj.user.api.RdcjUserApi;
import cn.intotw.rdcj.user.bean.UserVo;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.validation.Valid;

/**
 * @author Chenxiang
 * @Description: 测试用户
 * @create 2020/4/9 11:02
 * @see RdcjUserApi
 */
@RestController
@RequestMapping("/rdcj/user")
@Api(value = "/rdcj/user", tags = {"userTag"},description = "测试Controller接口类")
@Slf4j
public class UserApiController {
    @Value("${eureka.client.serviceUrl.defaultZone}")
    private String eurekaUrl;
    @ApiOperation(value = "Api-获取用户信息", notes = "Api-获取用户信息")
    @PostMapping("/v1/getUserInfo")
    public ModelAndView getUserInfo(@RequestBody @Valid @ApiParam(name = "用户信息", value = "传入json格式",
            required = true) UserVo userVo) {
        log.info("hello--------------------------------------------");
        return new ModelAndView(Constants.JSON_DATA_VIEW, DataResponse.successWithResult(userVo));
    }
    @ApiOperation(value = "Api-获取用户信息", notes = "Api-获取用户信息")
    @GetMapping("/v1/testForEnvPost")
    public ModelAndView testForEnvPost() {
        log.info("eurekaUrl is {}",eurekaUrl);
        return new ModelAndView(Constants.JSON_DATA_VIEW, DataResponse.successWithResult(null));
    }
}